home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 2.0 KB | 122 lines | [TEXT/ToyS] |
- property kasName : "FaxWatch"
- property kasFinder : "Finder"
-
- property kasPrint : true -- Print incoming faxes?
-
- global gasInfo
- global gasInfoLoc
- global gasLastStatus
-
-
- on run
- set gasInfoLoc to {-1, -1}
- set gasLastStatus to ""
-
- try
- set gasInfoLoc to load preference named kasName
- on error
- end try
-
- set gasInfo to ¬
- display info titled kasName ¬
- located at gasInfoLoc
- end run
-
-
- on idle
- ShowAction("Checking…")
-
- set n to FaxCheck()
-
- if (n > 0) then
- ShowStatus("NEW FAXES: " & n, 15 * 32)
-
- if kasPrint then FaxPrint()
- else
- ShowStatus("Read my lips - no new faxes", 15 * 32 * 32)
- end if
-
- ShowAction("Idle…")
-
- return 60 * 5
- end idle
-
-
- on ShowAction(act)
- display info gasInfo ¬
- message act ¬
- with static state
- end ShowAction
-
-
- on ShowStatus(msg, col)
- if (gasLastStatus is not msg) then
- display info gasInfo ¬
- message msg ¬
- using color col ¬
- using size 9 ¬
- using font ¬
- "Monaco" at line 2
-
- set gasLastStatus to msg
- end if
- end ShowStatus
-
-
- on quit
- ShowAction("Quitting…")
-
- set newLoc to screen location of ¬
- (display info gasInfo with disposal)
-
- if (newLoc is not gasInfoLoc) then ¬
- save preference newLoc named kasName
-
- continue quit
- end quit
-
-
- on FaxLaunch()
- end FaxLaunch
-
-
- on FaxCheck()
- tell application "Apple Fax"
- set n to number of faxes of unread faxes
- set auto answer mode to true
- end tell
-
- return n
- end FaxCheck
-
-
- on FaxPrint()
- tell application "Apple Fax" to ¬
- set numberReceived to number of faxes of unread faxes
-
- if (numberReceived > 0) then
- tell application "Apple Fax"
- activate
-
- set faxList to faxes of unread faxes as list
-
- -- Open each fax in the list and print it.
- repeat with aFax in faxList
- set theFile to get the file of aFax
- open theFile
- try
- ignoring application responses
- print theFile
- end ignoring
- on error
- beep
- end try
- tell me to pause for 60 with seconds timing
- close the front window
- end repeat
- end tell
- -- Quit "Apple Fax".
- quit application "Apple Fax"
- end if
- end FaxPrint
-